{%extends '../base/base.tpl'%}

{%block 'title'%}运营管理-mock{%/block%}

{%block 'header_css'%}
<link href="../../static/js/common/plugins/chosen/chosen.css?__inline" rel="stylesheet">
<link href="../../static/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
<link href="../../static/css/plugins/cropper/cropper.min.css" rel="stylesheet">  <!--图片上传加裁剪-->


<!-- 上传组件 -->
<link href="../../static/js/common/plugins/fileinput/fileinput.min.css" rel="stylesheet"/>
<!--富文本 -->
<link href="../../static/js/common/plugins/kindeditor/themes/qq/qq.css" rel="stylesheet"/>
<link href="../../static/css/animate.min.css" rel="stylesheet">
<link href="../../static/css/style.min.css?__inline" rel="stylesheet">
<link href="../../static/css/common.css?__inline" rel="stylesheet">


  <style type="text/css">
    table{font-size:13px;text-align:center;}
    thead{font-weight:bold;text-align:center;}
    th{text-align: center;}
    .list_edit_table{}
      .is_must{line-height: 34px;}
      table a{display: inline-block;}
    .img-preview-sm{height:78px;}
    @media screen and (min-width:768px){.modal-dialog{width:1100px; }}
    .note-editor .note-editable{background: #fff}
    .note-editable{min-height: 200px;}
    .tangram-suggestion-main{z-index: 10000}
    .BMapLabel{margin-top: -20px;max-width: inherit;}
    .btn-danger{    
      background-color: #ec4758;
      border-color: #ec4758;
      color: #FFF;
    }
    .btn-success{
      background-color: #1a7bb9;
      border-color: #1a7bb9;
      color: #FFF;
    }
  </style>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=37a211f6324bbdc732ff7b3f72a55216"></script>
{%/block%}

{%block 'header_js'%} 

{%/block%}

{%block 'foot'%}

{%/block%}

{%block 'body'%}
{%assign var=table_operation value="true" %}
{%assign var=table_btn value=array(
  [
    'url'=>'#',
    'text'=>'编辑',
    'type'=>'edit_btn',
    'data_target'=>'#table_detail',
    'data_toggle'=>'modal'
  ],
  [
    'url'=>'#',
    'text'=>'详情',
    'type'=>'detail_btn',
    'data_target'=>'#table_detail',
    'data_toggle'=>'modal'
  ],
  [
    'url'=>'#',
    'text'=>'删除',
    'type'=>'del_btn',
    'data_target'=>'null',
    'data_toggle'=>'null'
  ]
) %}
    <div id="wrapper">
      {%include file="../../widget/left_menu.tpl"%}
    <div id="page-wrapper" class="gray-bg dashbard-1">
    {%include file="../../widget/header.tpl"%}
    <div class="row J_mainContent" id="content-main">
      
            <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h3>首页排版</h3>
                    </div>
                    <div class="ibox-content">
                      <a type="button" href="#" class="btn btn-primary new_file_coupon" data-toggle="modal" data-target="#table_detail">新建首页排版</a>
                          {%include file="../../widget/table_mod.tpl"%}
                          {%include file="../../widget/pagination.tpl"%}

                    </div>
                </div>
        </div>
      {%include file="../../widget/footer.tpl"%}
      </div>
    </div>
    {%include file="../../widget/editable_mod.tpl"%}
{%/block%}
  
{%block 'foot_js'%}
<script src="../../static/js/common/plugins/chosen/chosen.jquery.js?__inline"></script>
<script src="../../static/js/common/content.min.js"></script>
<script src="../../static/js/common/plugins/validate/jquery.validate.min.js"></script>
<script src="../../static/js/common/plugins/validate/messages_zh.min.js"></script>
<script src="../../static/js/common/jquery.form.js"></script>
<script src="../../static/js/common/plugins/layer/laydate/laydate.js"></script> 
<script src="../../static/js/common/plugins/sweetalert/sweetalert.min.js"></script>
<script src="../../static/js/common/plugins/jeditable/jquery.jeditable.js"></script> 
<script src="../../static/js/common/plugins/dataTables/jquery.dataTables.js"></script> 
<script src="../../static/js/common/plugins/dataTables/dataTables.bootstrap.js"></script> 
<script src="../../static/js/common/plugins/cropper/cropper.min.js"></script> 
<script src="../../static/js/common/plugins/ajaxfileupload/ajaxfileupload.js"></script> 

<!-- 上传组件 -->
  <script src="../../static/js/common/plugins/fileinput/fileinput.min.js"></script>
  <script src="../../static/js/common/plugins/fileinput/fileinput_locale_zh.js"></script>
<!-- 富文本 -->
  <script src="../../static/js/common/plugins/kindeditor/kindeditor-all-min.js"></script>
  <script src="../../static/js/common/plugins/kindeditor/lang/zh_CN.js"></script>
<script src="../../static/js/table/tableoperation.js"></script>

<script type="text/javascript">
  KindEditor.ready(function(K) {

      window.editor = K.create('#vender_desc');
  });

       var isMark = false; 

    var customFun = {
        complete:function(){
          topType($("#type").val());
        $("#type").change(function(){
            var val = $(this).val(); 
            topType(val);
          });
        $("#list_type").change(function(){
            var val = $(this).val(); 
            listType(val);
          });

        var venderImgLogoPath = $("#cover_img_url").attr("data-url");
        var initalPreview = "";
        if(venderImgLogoPath){
          initalPreview = "<img src='" + venderImgLogoPath + "' class='file-preview-image'>";
        }

        $("#cover_img_url").fileinput({
          showUpload: false,
          browseLabel: "选择图片",
          allowedFileExtensions: ["jpg", "jpeg", "gif", "png"],
          initialPreview: initalPreview
        });
        setTimeout(function(){
          var venderImgLogoPath = $("#banner_img_url").attr("data-url");
          var initalPreview = "";
          if(venderImgLogoPath){
            initalPreview = "<img src='" + venderImgLogoPath + "' class='file-preview-image'>";
          }

          $("#banner_img_url").fileinput({
            showUpload: false,
            browseLabel: "选择图片",
            allowedFileExtensions: ["jpg", "jpeg", "gif", "png"],
            initialPreview: initalPreview
          });
        },1000)
        KindEditor.ready(function(K) {
            window.editor = K.create('#content', {
        items: [
          'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'cut', 'copy', 'paste',
          'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
          'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
          'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
          'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
          'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image', 'multiimage',
          'insertfile', 'table', 'hr', 'emoticons', 'baidumap', 'pagebreak',
          'anchor', 'link', 'unlink'
        ],
        uploadJson: '/upload/img',
        fileManagerJson: '',
        allowFileManager: false,
        resizeType: 1,
        afterCreate: function () {
          var self = this;
          K.ctrl(document, 13, function () {
            self.sync();
            K('form[name=example]')[0].submit();
          });
          K.ctrl(self.edit.doc, 13, function () {
            self.sync();
            K('form[name=example]')[0].submit();
          });
        },
        afterBlur: function () { this.sync(); }
      });
        });
        $("#cover_img_url").change(function(){
            var img_file = $(this).val();
            $.ajaxFileUpload({  
                url: '/upload/img',  
                secureuri: false,  
                data:{'img_file':img_file},  
                fileElementId:'vender_img',  
                dataType: 'xml',  
                success: function (data, status) {  
                    if (data.errno == 0) {  
                       $("#vender_img_ed").val(data.url);
                      swal("恭喜您！", "提交成功啦。");
                    }  
                    else{  
                       $("#vender_img_ed").val(data.url);
                    }  
                } 
            });  

        })
$("#banner_img_url").change(function(){
            var img_file = $(this).val();
            $.ajaxFileUpload({  
                url: '/upload/img',  
                secureuri: false,  
                data:{'img_file':img_file},  
                fileElementId:'vender_img',  
                dataType: 'xml',  
                success: function (data, status) {  
                    if (data.errno == 0) {  
                       $("#vender_img_ed").val(data.url);
                      swal("恭喜您！", "提交成功啦。");
                    }  
                    else{  
                       $("#vender_img_ed").val(data.url);
                    }  
                } 
            });  

        })
        }



        
      
      };
common_option = customFun;
function topType(val){
  if(val == 0){
      $("#coupon_ids").parent().parent(".form-group").hide();
      $("#list_type").parent().parent(".form-group").show();
      listType($("#list_type").val());
  }else if(val == 1){
      $("#coupon_ids").parent().parent(".form-group").show();
      $("#list_type").parent().parent(".form-group").hide();
      allHide();
  }else{
      $("#coupon_ids").parent().parent(".form-group").hide();
      $("#list_type").parent().parent(".form-group").hide();
      allHide();
  }
}
      
function listType(val){
  if(val == 0){//商家
    $("#vender_ids").parent().parent(".form-group").show(); //商家
    $("#ticket_goods_ids").parent().parent(".form-group").hide(); //票类商品
    $("#entity_goods_ids").parent().parent(".form-group").hide(); //实体
  }else if(val == 1){//票类商品
    $("#vender_ids").parent().parent(".form-group").hide(); //商家
    $("#ticket_goods_ids").parent().parent(".form-group").show(); //票类商品
    $("#entity_goods_ids").parent().parent(".form-group").hide(); //实体
  }else if(val == 2){//实体
    $("#vender_ids").parent().parent(".form-group").hide(); //商家
    $("#ticket_goods_ids").parent().parent(".form-group").hide(); //票类商品
    $("#entity_goods_ids").parent().parent(".form-group").show(); //实体
  }else{
    allHide();
  }
}
  function allHide(){
    $("#vender_ids").parent().parent(".form-group").hide(); //商家
    $("#ticket_goods_ids").parent().parent(".form-group").hide(); //票类商品
    $("#entity_goods_ids").parent().parent(".form-group").hide(); //实体
  }   
  
    
  

  

  
  
  

 

</script> 
{%/block%}

